//
// Created by Castle-Moriarty on 2025/11/07.
//

#include <iostream>
using namespace std;

int main() {
    // 数组删除问题
    int n, a[100010], x, xb = 0;
    cin >> n;
    for (int i = 0; i <= n; i++) {
        cin >> a[i];
    }
    cin >> x;
    for (int i = 1; i <= n; i++) {
        if (a[i] == x) {
            xb = i;
            break;
        }
    }

    if (xb == 0) {
        cout << "Failed";
    } else {
        for (int i = xb; i <= n - 1; i++) {
            a[i] = a[i + 1];
        }
        for (int i = 1; i <= n - 1; i++) {
            cout << a[i] << " ";
        }
    }


    return 0;
}
